package test.generics;

public class GenericFactory<F> {

	public static void main(String[] args) throws IllegalAccessException, InstantiationException {

		GenericFactory<MyClass> factory = new GenericFactory<MyClass>(MyClass.class);

		MyClass myClassInstance = factory.createInstance();
		myClassInstance.a();
	}

	Class theClass = null;

	public GenericFactory(Class theClass) {
		this.theClass = theClass;
	}

	public F createInstance() throws IllegalAccessException, InstantiationException {
		return (F) this.theClass.newInstance();
	}
}
